﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Ylh.BLL
{
   public class CustServerBLL
    {

       private string ConStr = string.Empty;

       public CustServerBLL(string ConStr)
       {
           this.ConStr = ConStr;
       }



        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int InserServer( Ylh.Model.TbCustServer model)
        {
            Ylh.IDAL.ICustServer server = Ylh.FactoryDAL.DataAccess.CreateICustServer();
            return server.InserServer(ConStr, model);

        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateServer(Ylh.Model.TbCustServer model)
        {
            Ylh.IDAL.ICustServer server = Ylh.FactoryDAL.DataAccess.CreateICustServer();
            return server.UpdateServer(ConStr, model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool DeleteServerInfo(int CustServerID)
        {

            Ylh.IDAL.ICustServer server = Ylh.FactoryDAL.DataAccess.CreateICustServer();
            return server.DeleteServerInfo(ConStr, CustServerID);
        }


        /// <summary>
        /// 查找所有数据
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="CustID"></param>
        /// <returns></returns>
        public DataTable SelectServerInfo( int CustID)
        {
            Ylh.IDAL.ICustServer server = Ylh.FactoryDAL.DataAccess.CreateICustServer();
            return server.SelectServerInfo(ConStr, CustID);
        }




        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Ylh.Model.TbCustServer GetModel( int CustServerID)
        {

            Ylh.IDAL.ICustServer server = Ylh.FactoryDAL.DataAccess.CreateICustServer();
            return server.GetModel(ConStr, CustServerID);
        }

        public void DeleteServerInfo(List<string> li)
        {
            foreach (string  str in li)
            {
                DeleteServerInfo( Convert.ToInt32(str));
            }
        }
    }
}
